using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PocketLibrary;

namespace PocketApps
{
    public partial class AppListForm : Form
    {
        PocketSettings.PocketSettings milkSettings = null;

        //PocketLibrary.IBlog selectedBlog;
        //PocketLibrary.BlogPost editPost = null;
        
        public AppListForm()
        {
            InitializeComponent();
        }

        private void AppListForm_Load(object sender, EventArgs e)
        {
            milkSettings = PocketSettings.PocketSettings.Create(HelperUtils.ApplicationPath + "settings\\PocketSettings.xml");
            this.Localize();
        }

        void Localize()
        {
            try
            {
                miExecute.Text = PocketAppsLocalization.GetString("start");
                miMenu.Text = PocketAppsLocalization.GetString("menu");
                miAbout.Text = PocketAppsLocalization.GetString("about");
                miAsetukset.Text = PocketAppsLocalization.GetString("options");

            }
            catch { }

        }


        private void miClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void miExecute_Click(object sender, EventArgs e)
        {
            string serviceName = appListView.Items[appListView.SelectedIndices[0]].Text;

            switch (serviceName)
            {
                case "Singapore":
                    using (SingaporeMain sgal = new SingaporeMain())
                    {
                        sgal.Owner = this;
                        sgal.ShowDialog();
                    }
                    break;
                case "flickr":
                    using (flickrMain flickr = new flickrMain())
                    {
                        flickr.Owner = this;
                        flickr.ShowDialog();
                    }
                    break;
                case "box.net":
                    using (BoxNetRestForm box = new BoxNetRestForm())
                    {
                        box.Owner = this;
                        box.ShowDialog();
                    }
                    break;
                case "openomy":
                    using (OpenomyMain open = new OpenomyMain())
                    {
                        open.Owner = this;
                        open.ShowDialog();
                    }
                    break;
                case "voo2do":
                    using (voo2doForm v2do = new voo2doForm())
                    {
                        v2do.Owner = this;
                        v2do.ShowDialog();
                    }
                    break;
                case "checklist":
                    break;
                case "blogs":
                    using (BlogWriter blogs = new BlogWriter())
                    {
                        blogs.Owner = this;
                        blogs.ShowDialog();
                    }
                    break;
                case "fridge":
                    using (PocketApps.fridge.fridgeForm frdge = new PocketApps.fridge.fridgeForm())
                    {
                        frdge.Owner = this;
                        frdge.ShowDialog();
                    }
                    break;
                default:
                    break;
            }
        }


        private void miAsetukset_Click(object sender, EventArgs e)
        {
            using (WebAppSettings asetukset = new WebAppSettings())
            {
                asetukset.ShowDialog();
            }
        }

        private void miAbout_Click(object sender, EventArgs e)
        {
            using (Tietoja fTietoja = new Tietoja())
            {
                fTietoja.ShowDialog();
            }
        }
    }
}